package com.example.administrator.xiaoxiang.utils;

import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

/**
 * Created by Administrator on 2017/1/3.
 */

public abstract class BaseCallback<T> {
//    public  abstract void onBeforeRequest(Request request);
//    public abstract void onFailure(Request request, IOException e) ;
//    public abstract void onResponse(String string) ;
   public  abstract void onBeforeRequest(Request request);


    public abstract  void onFailure(Request request, Exception e) ;


    /**
     *请求成功时调用此方法
     * @param response
     */
    public abstract  void onResponse(Response response);

    /**
     *
     * 状态码大于200，小于300 时调用此方法
     * @param response


     */
    public abstract void onSuccess(String response) ;

    /**
     * 状态码400，404，403，500等时调用此方法
     * @param response
     * @param code
     * @param e
     */
    public abstract void onError(Response response, int code,Exception e) ;


}
